# Recipe file for xapian-core.
#
# Maintainers: (C) 2017 Mateus P. Rodrigues, mprodrigues@dragora.org.
#
# Under the terms of the GNU General Public License.

program=xapian-core
version=1.2.24
release=1

description="
Xapian is an Open Source Search Engine Library, released under the GPL v2+.
"

homepage=https://xapian.org/
license=GPLv2+

tarname=${program}-${version}.tar.xz

# Remote source(s)
fetch="http://oligarchy.co.uk/xapian/1.2.24/${tarname}"

# Parallel jobs for the compiler
jobs=1

# Source documentation
docs="AUTHORS COPYING ChangeLog* HACKING INSTALL NEWS PLATFORMS README"

build() {
    unpack "${tardir}/$tarname"

    cd "$srcdir"

    ./configure \

    make -j${jobs}
    make -j${jobs} install DESTDIR="$destdir"

    # Compress manual pages
    if [ -d "${destdir}/$mandir" ] ; then
	(
            cd "${destdir}/$mandir"
	    find . -type f -exec lzip -9 '{}' +
	    find . -type l | while read -r file
	    do
		ln -sf "$(readlink -- "$file").lz" "${file}.lz"
		rm -- "$file"
	    done
	)
    fi

    # Copy documentation
    mkdir -p "${destdir}/usr/local/share/doc/${program}-${version}"
    cp -p $docs "${destdir}/usr/local/share/doc/${program}-${version}/"
}
